<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <script>
            let arr = [1, 2, 3];
            // 查找元素 1 从下标1开始
            // let flag = arr.includes(1, 1);
            // console.log(flag); // false

            Array.prototype.myIncludes = function (value, start = 0) {
                if (start < 0) start = this.length + start;
                for (; start < this.length; start++) {
                    if (this[start] === value) {
                        return true;
                    }
                }
                return false;
            };
            let flag = arr.myIncludes(1, 1);
            console.log(flag); // false
        </script>
    </body>
</html>
